package controle.log;

import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import dao.GenericDao;

import model.Usuario;

public class HistoricoDao extends GenericDao{
	

	public HistoricoDao() {
		super();
	}
	
	public void adicionar(PreparedStatement ps,Usuario executor) throws SQLException{
		
		String sql = "insert into historico (sql,idusuario,data) values (?,?,?)";
		PreparedStatement stmt = con.prepareStatement(sql);
		stmt.setString(1, ps.toString());
		stmt.setInt(2, executor.getId());
		stmt.setDate(3, new Date(System.currentTimeMillis()));
		stmt.execute();
		this.setQuery(stmt.toString());

		stmt.close();
		con.close();
	}
	

}
